<!doctype html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <title>表单管理 - 系统后台 - {$Config.sitename} - by ShuipFCMS</title>
    <AdminTpl file="Admin/Common/Cssjs"/>
    <style type="text/css">
        .col-auto {
            overflow: hidden;
            _zoom: 1;
            _float: left;
            border: 1px solid #c2d1d8;
        }
        .col-right {
            float: right;
            width: 210px;
            overflow: hidden;
            margin-left: 6px;
            border: 1px solid #c2d1d8;
        }
        body fieldset {
            border: 1px solid #D8D8D8;
            padding: 10px;
            background-color: #FFF;
        }
        body fieldset legend {
            background-color: #F9F9F9;
            border: 1px solid #D8D8D8;
            font-weight: 700;
            padding: 3px 8px;
        }
        .list-dot {
            padding-bottom: 10px
        }
        .list-dot li, .list-dot-othors li {
            padding: 5px 0;
            border-bottom: 1px dotted #c6dde0;
            font-family: "宋体";
            color: #bbb;
            position: relative;
            _height: 22px
        }
        .list-dot li span, .list-dot-othors li span {
            color: #004499
        }
        .list-dot li a.close span, .list-dot-othors li a.close span {
            display: none
        }
        .list-dot li a.close, .list-dot-othors li a.close {
            background: url("/static/common/images/cross.png") no-repeat left 3px;
            display: block;
            width: 16px;
            height: 16px;
            position: absolute;
            outline: none;
            right: 5px;
            bottom: 5px
        }
        .list-dot li a.close:hover, .list-dot-othors li a.close:hover {
            background-position: left -46px
        }
        .list-dot-othors li {
            float: left;
            width: 24%;
            overflow: hidden;
        }
        .hidden{display: none;}
    </style>
</head>
<body class="J_scroll_fixed">
    <div class="wrap J_check_wrap">
        <div class="nav">
            <ul class="cc">
                <li class="current">
                    支付配置
                </li>
            </ul>
        </div>
        <form name="myform" id="myform" action="{:U("Payment/doedit")}" method="post" enctype="multipart/form-data">
              <div class="col-right" id="right_box">
                <div class="table_full">
                    <table width="100%">

                    </table>
                </div>
            </div>
            <div class="col-auto">
                <div class="h_a">基本设置</div>
                <div class="table_full">
                    <table cellpadding=0 cellspacing=0 class="table_form" width="100%">
                        <tr> 
                            <td  width="100">{:L(payment_mode)}：</td> 
                            <td>{$vo.pay_name}</td> 
                        </tr> 
                        <tr> 
                            <td  width="120">{:L(name)}：</td> 
                            <td><input type="text" name="pay_name" value="{$vo.pay_name}" class="input-text" id="pay_name"  validate="required:true,cn_username:true, minlength:2, maxlength:20" /></td> 
                        </tr> 



                        <useTPL id="form_content" formtype="editor" field="content" value="$vo[pay_desc]" name="描述">
                            <!--文本-->
                            <setType name="默认值">
                                <setVal id="['setting']['defaultvalue']"></setVal>
                            </setType>
                            <setType name="编辑器默认高度">
                                <setVal id="['setting']['height']">200</setVal>
                            </setType>
                            <!--单选框,下拉-->
                            <setType name="后台编辑器样式">
                                <setVal id="['setting']['toolbar']" name="简洁型 ">basic</setVal>
                            </setType>
                            <setType name="前台编辑器样式">
                                <setVal id="['setting']['mbtoolbar']" name="简洁型 ">basic</setVal>
                            </setType>
                            <setType name="是否保存远程图片">
                                <setVal id="['setting']['enablesaveimage']" name="否">0</setVal>
                            </setType>
                        </useTPL>
                        <!--默认的模版-->
                        <showTPL name="content">
                            <tr>
                                <th width="80">{$form['name']}</th>
                                <td>
                            <if condition="$form['star']"> <font color="red">*</font>
                            </if>
                            {$form['form']}{$form['tips']}
                            </td>
                            </tr>
                        </showTPL>
                        <tr> 
                            <td  width="120">排序：</td> 
                            <td><input type="text" name="listorder" value="{$vo[listorder]|intval}" class="input-text" id="listorder" size="3" /></td> 
                        </tr> 
                        <tr> 
                            <td  width="120">{:L(online)}：</td> 
                            <td><if condition="$vo['is_online']">是<else />否</if></td> 
                        </tr> 
                        <tr> 
                            <td  width="120">{:L(pay_factorage)}：</td> 
                            <td id="pay_fee"><input name="pay_fee_type"  value="0" type="radio" {if !$vo[pay_fee_type]}checked{/if}> {:L(pay_method_rate)}&nbsp;&nbsp;&nbsp;<input name="pay_fee_type" value="1" type="radio"   {if $vo[pay_fee_type]}checked{/if}> {:L(pay_method_fix)}&nbsp;&nbsp;&nbsp; </td> 
                        </tr> 
                        <tr><td></td> 
                            <td> 
                                <div id="rate" <if condition="$vo[pay_fee_type]">class="hidden"</if> >
                                    {:L(pay_rate)}
                                    <input type="text" size="3" class="input-text"  value="{$vo.pay_fee}" name="pay_rate">
                                    &nbsp;%&nbsp;&nbsp;&nbsp;&nbsp;{:L(pay_method_rate_desc)}
                                </div> 
                                <div id="fix"  <if condition="!$vo[pay_fee_type]">class="hidden"</if> > 
                                    {:L(pay_fix)}
                                    <input type="text" name="pay_fix" class="input-text"  size="3" value="{$vo.pay_fee}">
                                    &nbsp;&nbsp;&nbsp;&nbsp; 
                                    {:L(pay_method_fix_desc)}
                                </div> 
                            </td> 
                        </tr> 
                    </table>
                </div>
                <div class="h_a">参数配置</div>
                <div class="table_full">
                    <table width="100%" class="table_form"> 
                        <volist name="vo[config]" id="r">
                            <if condition="$r['type']=='text'">
                                <tr> 
                                    <td>{:L($r[name])}</td>
                                    <td> 
                                        <input type="text"  class="input-text" name="pay_config[{$r.name}]" id="{$r.name}" value="{$r.value}" size="40" /> 
                                    </td> 
                                </tr> 
                                <else/>
                                <tr> 
                                    <td>{:L($r[name])}</td>
                                    <td>
                                        <select class="valid" onchange="" name="pay_config[{$r[name]}]" id="pay_config[{$r[name]}]">
                                            <volist name="r.option" id="op">
                                                <option value="{$i}"  <if condition="$i == $r[value]">selected="selected"</if>>{$op}</option>
                                            </volist>
                                        </select>
                                    </td> 
                                </tr> 
                            </if>
                        </volist>
                    </table>
                </div>
                <div class="" style="">
                    <div class="btn_wrap_pd">
                        <button class="btn btn_submit "type="submit">提交</button>
                    </div>
                </div>
            </div>
            <input type="hidden" name="isajax" value="1" />
            <input type="hidden"  name="id" value="{$vo.id}" /> 
            <input type="hidden"  name="pay_code" value={$vo.pay_code} /> 
            <input type="hidden"  name="is_cod" value={$vo.is_cod} /> 
            <input type="hidden"  name="is_online" value={$vo.is_online} /> 
        </form>
    </div>
    <script type="text/javascript" src="/static/common/js/common.js?v"></script>
    <script type="text/javascript" src="/static/common/js/content_addtop.js"></script>
    <script type="text/javascript" src="/Public/App/DC/lib/js/area.js?jversion=2.0"></script>
    <?php
    $area = array_filter(explode('_', $vo['shop_area']));
    ?>
    <script type="text/javascript"> 
        $(function() {
            $("#pay_fee input[type='radio']").click( function () {
                if($(this).val()== 0){
                    $("#rate").removeClass('hidden');
                    $("#fix").addClass('hidden');
                    $("#rate input").val('0');
                } else {
                    $("#fix").removeClass('hidden');
                    $("#rate").addClass('hidden');
                    $("#fix input").val('0');
                }	
            });
        
            //初始 省、市、区
            ajax_address(0, 'country', '{$area[1]|intval}');
            ajax_address('{$area[1]|intval}', 'city', '{$area[2]|intval}');
            ajax_address('{$area[2]|intval}', 'area', '{$area[3]|intval}');
            if ($("#right_box").find("tr").length == 0) {
                $("#right_box").css("display", "none");
            }
            $(".J_ajax_close_btn").on('click', function(e) {
                e.preventDefault();
                Wind.use("artDialog", function() {
                    art.dialog({
                        id: "question",
                        icon: "question",
                        fixed: true,
                        lock: true,
                        background: "#CCCCCC",
                        opacity: 0,
                        content: "您确定需要关闭当前页面嘛？",
                        ok: function() {
                            setCookie("refersh_time", 1);
                            window.close();
                            return true;
                        }
                    });
                });
            });
            Wind.use('validate', 'ajaxForm', 'artDialog', function() {
                //javascript
                            <show_ext type="formJavascript" />
                                            var form = $('form.J_ajaxForms');
                                        //ie处理placeholder提交问题
                                        if ($.browser.msie) {
                                            form.find('[placeholder]').each(function() {
                                                var input = $(this);
                                                if (input.val() == input.attr('placeholder')) {
                                                    input.val('');
                                                }
                                            });
                                        }
                                        //表单验证开始
                                        form.validate({
                                            //是否在获取焦点时验证
                                            onfocusout: false,
                                            //是否在敲击键盘时验证
                                            onkeyup: false,
                                            //当鼠标掉级时验证
                                            onclick: false,
                                            //验证错误
                                            showErrors: function(errorMap, errorArr) {
                                                //errorMap {'name':'错误信息'}
                                                //errorArr [{'message':'错误信息',element:({})}]
                                                try {
                                                    $(errorArr[0].element).focus();
                                                    art.dialog({
                                                        id: 'error',
                                                        icon: 'error',
                                                        lock: true,
                                                        fixed: true,
                                                        background: "#CCCCCC",
                                                        opacity: 0,
                                                        content: errorArr[0].message,
                                                        cancelVal: '确定',
                                                        cancel: function() {
                                                            $(errorArr[0].element).focus();
                                                        }
                                                    });
                                                } catch (err) {}
                                            },
                                            //验证规则
                                            rules: <show_ext type = "formValidateRules" / > ,
                                            //验证未通过提示消息
                                            messages: <show_ext type = "formValidateMessages" / > ,
                                            //给未通过验证的元素加效果,闪烁等
                                            highlight: false,
                                            //是否在获取焦点时验证
                                            onfocusout: false,
                                            //验证通过，提交表单
                                            submitHandler: function(forms) {
                                                $(forms).ajaxSubmit({
                                                    url: form.attr('action'), //按钮上是否自定义提交地址(多按钮情况)
                                                    dataType: 'json',
                                                    beforeSubmit: function(arr, $form, options) {

                                                    },
                                                    success: function(data, statusText, xhr, $form) {
                                                        if (data.status) {
                                                            setCookie("refersh_time", 1);
                                                            //添加成功
                                                            Wind.use("artDialog", function() {
                                                                art.dialog({
                                                                    id: "succeed",
                                                                    icon: "succeed",
                                                                    fixed: true,
                                                                    lock: true,
                                                                    background: "#CCCCCC",
                                                                    opacity: 0,
                                                                    content: data.info,
                                                                    button: [{
                                                                            name: '留在此页面？',
                                                                            callback: function() {
                                                                                reloadPage(window);
                                                                                return true;
                                                                            },
                                                                            focus: true
                                                                        }, {
                                                                            name: '关闭当前页面',
                                                                            callback: function() {
                                                                                window.close();
                                                                                return true;
                                                                            }
                                                                        }]
                                                                });
                                                            });
                                                        } else {
                                                            isalert(data.info);
                                                        }
                                                    }
                                                });
                                            }
                                        });
                                    });
                                });
    </script>
</body>
</html>